package Stackdemo;
import java.util.Arrays;
import java.util.Queue;
import java.util.LinkedList;
public class MyStack {

    public int[] elem;
    public int usedSize;

    public MyStack() {
        elem = new int[10];
    }

    public void push(int val) {
//1. 如果满了进行扩容
        if(usedSize == elem.length){
           elem = Arrays.copyOf(elem,elem.length*2);
        }

//2. 才可以入栈
        elem[usedSize] = val;
//3. us++
        usedSize++;
    }
    public Boolean isFull(){
        return usedSize == elem.length;
    }
}
